package com.erlinyou.im.web.controller.push;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Properties;


public class globalSetting {

	/**
	 * for S3 region
	 */
	public static String sRegion="cn-north-1";
	
	/**
	 * IOS certification
	 * voip_
	 */
	public static String voip_sCAEnviorment = "product";
	public static String voip_sCAFile="navPushMsgProduct.p12";
	public static String voip_sCAPass="Password";
	/**
	 * IOS certification
	 */
	public static String sCAEnviorment = "product";
	public static String sCAFile="navPushMsgProduct.p12";
	public static String sCAPass="Password";
	
	/**
	 * MQTT
	 */
	public static String sMQTTURLMaster = null;
	public static String sMQTTIDMaster = null;
	public static String sMQTTURLSlave1883 = null;
	public static String sMQTTIDSlave1883 = null;
	public static String sMQTTURLSlave1884 = null;
	public static String sMQTTIDSlave1884 = null;
	public static String sMQTTURLSlave1885 = null;
	public static String sMQTTIDSlave1885 = null;
	public static String sMQTTURLSlave1886 = null;
	public static String sMQTTIDSlave1886 = null;
	public static String sMQTTURLSlave1887 = null;
	public static String sMQTTIDSlave1887 = null;
	public static String sMQTTURLSlave1888 = null;
	public static String sMQTTIDSlave1888 = null;
	
	public static String cserviceServerurl = null;
	
	static
	{
		try
		{
			URL url = globalSetting.class.getResource("/globalSetting.properties");
			Properties properties = new Properties();
			InputStream propsStream = url.openStream();
			properties.load(propsStream);
			propsStream.close();
		
			sRegion = properties.getProperty("region");
			if(sRegion.equals("local"))
			{
			
				cserviceServerurl = properties.getProperty("cserviceServerurl_local");
				
				
				//IOS certification
				sCAEnviorment = properties.getProperty("enviroment_local");
				sCAFile = properties.getProperty("CAFile_local");
				sCAPass = properties.getProperty("CAPass_local");
				
				//IOS certification
				voip_sCAEnviorment = properties.getProperty("voip_enviroment_local");
				voip_sCAFile = properties.getProperty("voip_CAFile_local");
				voip_sCAPass = properties.getProperty("voip_CAPass_local");
				//
				sMQTTURLSlave1883 = properties.getProperty("mqttURL_Slave_1883");
				sMQTTIDSlave1883 = properties.getProperty("mqttID_Slave_1883");
				
				sMQTTURLSlave1884 = properties.getProperty("mqttURL_Slave_1884");
				sMQTTIDSlave1884 = properties.getProperty("mqttID_Slave_1884");
				
				sMQTTURLSlave1885 = properties.getProperty("mqttURL_Slave_1885");
				sMQTTIDSlave1885 = properties.getProperty("mqttID_Slave_1885");
				
				sMQTTURLSlave1886 = properties.getProperty("mqttURL_Slave_1886");
				sMQTTIDSlave1886 = properties.getProperty("mqttID_Slave_1886");
				
				sMQTTURLSlave1887 = properties.getProperty("mqttURL_Slave_1887");
				sMQTTIDSlave1887 = properties.getProperty("mqttID_Slave_1887");
				
				sMQTTURLSlave1888 = properties.getProperty("mqttURL_Slave_1888");
				sMQTTIDSlave1888 = properties.getProperty("mqttID_Slave_1888");
				
				sMQTTURLMaster = properties.getProperty("mqttURLMaster_local");
				sMQTTIDMaster = properties.getProperty("mqttIDMasterCN");
				
			}
			else if(sRegion.equals("cn-north-1"))
			{

				cserviceServerurl = properties.getProperty("cserviceServerurl_cn");
				
	
				//IOS certification
				sCAEnviorment = properties.getProperty("enviroment");
				sCAFile = properties.getProperty("CAPath");
				sCAPass = properties.getProperty("CAPass");
				
				//IOS certification
				voip_sCAEnviorment = properties.getProperty("voip_enviroment");
				voip_sCAFile = properties.getProperty("voip_CAPath");
				voip_sCAPass = properties.getProperty("voip_CAPass");
				//
				sMQTTURLMaster = properties.getProperty("mqttURLMaster");
				sMQTTIDMaster = properties.getProperty("mqttIDMasterCN");
				
				sMQTTURLSlave1883 = properties.getProperty("mqttURL_Slave_1883");
				sMQTTIDSlave1883 = properties.getProperty("mqttID_Slave_1883");
				
				sMQTTURLSlave1884 = properties.getProperty("mqttURL_Slave_1884");
				sMQTTIDSlave1884 = properties.getProperty("mqttID_Slave_1884");
				
				sMQTTURLSlave1885 = properties.getProperty("mqttURL_Slave_1885");
				sMQTTIDSlave1885 = properties.getProperty("mqttID_Slave_1885");
				
				sMQTTURLSlave1886 = properties.getProperty("mqttURL_Slave_1886");
				sMQTTIDSlave1886 = properties.getProperty("mqttID_Slave_1886");
				
				sMQTTURLSlave1887 = properties.getProperty("mqttURL_Slave_1887");
				sMQTTIDSlave1887 = properties.getProperty("mqttID_Slave_1887");
				
				sMQTTURLSlave1888 = properties.getProperty("mqttURL_Slave_1888");
				sMQTTIDSlave1888 = properties.getProperty("mqttID_Slave_1888");
			}
			else if(sRegion.equals("eu-central-1"))
			{
				
				cserviceServerurl = properties.getProperty("cserviceServerurl_eu");
				
				//IOS certification
				sCAEnviorment = properties.getProperty("enviroment");
				sCAFile = properties.getProperty("CAPath");
				sCAPass = properties.getProperty("CAPass");
				
				//IOS certification
				voip_sCAEnviorment = properties.getProperty("voip_enviroment");
				voip_sCAFile = properties.getProperty("voip_CAPath");
				voip_sCAPass = properties.getProperty("voip_CAPass");
				
				//
				sMQTTURLMaster = properties.getProperty("mqttURLMaster");
				sMQTTIDMaster = properties.getProperty("mqttIDMasterEU");
				
				sMQTTURLSlave1883 = properties.getProperty("mqttURL_Slave_1883");
				sMQTTIDSlave1883 = properties.getProperty("mqttID_Slave_1883");
				
				sMQTTURLSlave1884 = properties.getProperty("mqttURL_Slave_1884");
				sMQTTIDSlave1884 = properties.getProperty("mqttID_Slave_1884");
				
				sMQTTURLSlave1885 = properties.getProperty("mqttURL_Slave_1885");
				sMQTTIDSlave1885 = properties.getProperty("mqttID_Slave_1885");
				
				sMQTTURLSlave1886 = properties.getProperty("mqttURL_Slave_1886");
				sMQTTIDSlave1886 = properties.getProperty("mqttID_Slave_1886");
				
				sMQTTURLSlave1887 = properties.getProperty("mqttURL_Slave_1887");
				sMQTTIDSlave1887 = properties.getProperty("mqttID_Slave_1887");
				
				sMQTTURLSlave1888 = properties.getProperty("mqttURL_Slave_1888");
				sMQTTIDSlave1888 = properties.getProperty("mqttID_Slave_1888");
			}
			else
			{
				;
			}
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
}
